package com.bonjour.work.kern;

import com.bonjour.common.core.ICodeMSG;

public enum CodeMSG implements ICodeMSG {
    SUCCESS(0, "成功"),
    SAME_ARTICLE_NAME(20001, "名重复，请重新填写"),
    UPLOAD_FILE_NULL(20002, "上传失败，请选择文件"),
    MINIO_FILE_ERROR(20003, "文件操作失败"),
    OLD_PWD_ERROR(20004, "旧密码错误"),
    NO_SUCH_USER(20005, "无此用户"),
	USER_ALREADY_EXIST(20006, "此用户已被注册"), 
	PWD_ERROR(20007, "密码错误"), 
	FORBIDDEN_ERROR(20008, "此用户被冻结"),
	PARAM_ERROR(20010, "请求参数错误");
	
    private final int code;
    private final String msg;

    CodeMSG(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }
    
    public static boolean isFail(CodeMSG code) {
    	return code.code > 20000 ? true : false;
    }
}